#!/bin/python
# -*- coding: utf-8 -*-
# 10、编写python脚本，判断文件是否存在，如果存在写入内容“hello world”。判断文件路径从命令行输入。
import os
import sys

args = sys.argv
for i in range(len(args)):
    if args[i] == '-f' and i + 1 < len(args):
        path = args[i + 1]
if os.path.isfile(path):
    with open(path, "a") as f:
        f.write("hello world")
